/*
 * Copyright (C) 2013 Roy Wang
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.dolphinwang.imagecoverflow;

import ohos.data.rdb.DataObservable;
import ohos.data.rdb.DataObserver;
import ohos.media.image.PixelMap;

/**
 * Cover FlowAdapter
 */
public abstract class CoverFlowAdapter {
    private final DataObservable mDataSetObservable = new DataObservable();

    /**
     * register DataSetObserver
     * @param observer DataObservers
     */
    public void registerDataSetObserver(DataObserver observer) {
        mDataSetObservable.add(observer);
    }

    /**
     * un register DataSet Observer
     * @param observer DataObserver
     */
    public void unregisterDataSetObserver(DataObserver observer) {
        mDataSetObservable.remove(observer);
    }

    /**
     * notify DataSet Changed
     */
    public void notifyDataSetChanged() {
        mDataSetObservable.notifyObservers();
    }

    /**
     * notify DataSetInvalidated
     */
    public void notifyDataSetInvalidated() {
        mDataSetObservable.notifyObservers();
    }

    /**
     * get ItemView Type
     * @param position int
     * @return int
     */
    public int getItemViewType(int position) {
        return 0;
    }

    /**
     * get ViewType Count
     * @return int
     */
    public int getViewTypeCount() {
        return 1;
    }

    /**
     * get Count
     * @return int
     */
    public abstract int getCount();

    /**
     * get Image PixelMap
     * @param position int
     * @return PixelMap
     */
    public abstract PixelMap getImage(int position);
}
